package com.lrf.eb.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lrf.eb.mapper.EbNewsMapper;
import com.lrf.eb.model.EbNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service   //业务层--证

public class EbNewsService {
    @Autowired
    private EbNewsMapper ebNewsMapper;


    public Page<EbNews> page(int nsize, int newsSize){
        Page<EbNews> page= new Page(nsize,newsSize);
        Page<EbNews> newsPage = ebNewsMapper.selectPage(page,null);
        return newsPage;


    }
    public Page<EbNews> listByNews(int newsId, int nsize, int newsSize) {
        Page<EbNews> page = new Page<>(nsize, newsSize);
        Page<EbNews> newsPage = ebNewsMapper.selectPage(page,
                Wrappers.<EbNews>lambdaQuery().eq(EbNews::getEnTitle, newsId));
        return newsPage;

    }

    public EbNews detail(int enId){
        return ebNewsMapper.selectById(enId);
    }



}
